home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / CDTools / GoFetch! / arexx / Stephen_Bridges / batch2gofetch.rexx next >
OS/2 REXX Batch file  |  1999-11-04  |  4KB  |  151 lines

  1. /* $VER:Batch2GoFetch.rexx 0.8ß (04 Nov 99) Steve Bridges 
  2. ** 
  3. ** Stephen Bridges    <steve@bh01.demon.co.uk>
  4. **
  5. ** An Arexx script to use GoFetch to batch download files from
  6. ** Aminet from a created file. (For use with yam2gofetch.rexx)
  7. **
  8. */
  9.  
  10. OPTIONS RESULTS
  11.  
  12. /*
  13. ** INSTRUCTIONS
  14. **
  15. ** Alter the path to GoFetch and Miami to suit your set-up.
  16. ** Change the Miami settings for your set-up.
  17. ** Fill in the address of your nearest Aminet site.
  18. ** Also you will need to enter the path to the batchfile that was
  19. ** created with yam2gofetch.rexx.
  20. */
  21.  
  22. gofetch_path = 'AmiTCP:GoFetch/GoFetch!'
  23. miami_path =   'AmiTCP:Miami/Miami'
  24. settings =     'Miami:Miami.default'
  25.  
  26. site =         'ftp.demon.co.uk'
  27.  
  28. batch_file =   'Yam:gofetch.batch'
  29.  
  30. /*
  31. ** DO NOT CHANGE ANYTHING BELOW HERE UNLESS YOU KNOW WHAT
  32. ** YOU ARE DOING, ALTHOUGH THAT DIDN'T STOP ME. :-)
  33. */
  34.  
  35. /* Initialisation */
  36.  
  37. port =     '21'
  38.  
  39. FTP_PORT = 'GOFETCH'
  40. TCP_PORT = 'MIAMI.1'
  41.  
  42. title =             'batch2gofetch.rexx 0.8ß by Steve Bridges'
  43. g_error_text =      'ERROR:  Unable to launch GoFetch' ||'0a'x|| 'Did you amend the path in the script?' 
  44. b_error_text =      'ERROR:  Unable to find 'batch_file'' ||'0a'x|| '  Did you amend the settings in the script?'
  45. d_error_text =      'ERROR:  Unable to delete 'batch_file'' 
  46. m_error_text =      'ERROR:  Unable to launch Miami' ||'0a'x|| 'Did you amend the path in the script?'
  47. m_on_error_text =   'ERROR:  Miami unable to go on-line' ||'0a'x|| 'Is your modem switched on and plugged in? :-)'
  48. m_set_error_text =  'ERROR:  Miami unable to load settings' ||'0a'x|| 'Did you amend the settings in the script?'
  49.  
  50. exit_buttons = '_Exit'
  51.  
  52. /* Check if rexxreqtools.library/rexxsupport.library is installed */
  53.  
  54. IF ~EXISTS('Libs:rexxreqtools.library') THEN CALL library_error()
  55. IF ~EXISTS('Libs:rexxsupport.library') THEN CALL library_error()
  56.  
  57. /* Add rexxreqtools.library/rexxsupport.library to functions */
  58.  
  59. IF ~SHOW('L','rexxreqtools.library') THEN ADDLIB('rexxreqtools.library', 5, -30, 0)
  60. IF ~SHOW('L','rexxsupport.library') THEN ADDLIB('rexxsupport.library', 0, -30, 0)
  61.  
  62. /* Open Batchfile */
  63.  
  64. IF ~OPEN('created_file',batch_file,'R') THEN CALL SCRIPT_ERROR(b_error_text)
  65.  
  66. /* Get Miami running */
  67.  
  68. IF ~SHOW('P',TCP_PORT) THEN DO
  69.  ADDRESS COMMAND
  70.  'RUN >NIL:' miami_path nogui
  71.  'SYS:rexxc/WaitForPort' TCP_PORT
  72.  IF RC>0 THEN CALL SCRIPT_ERROR(m_error_text)
  73. END
  74.  
  75. /* Miami Online */
  76.  
  77. ADDRESS (TCP_PORT)
  78. LOADSETTINGS settings
  79. IF RC>0 THEN CALL SCRIPT_ERROR(m_set_error_text)
  80. ISONLINE
  81. IF RC=0 THEN DO
  82.  ONLINE
  83.  ISONLINE
  84.  IF RC=0 THEN CALL SCRIPT_ERROR(m_on_error_text)
  85. END
  86.  
  87. /* Get GoFetch Running */
  88.  
  89. IF ~SHOW('P',FTP_PORT) THEN DO
  90.  ADDRESS COMMAND
  91.  'RUN >NIL:' gofetch_path
  92.  'SYS:rexxc/WaitForPort' FTP_PORT
  93.  IF RC>0 THEN CALL SCRIPT_ERROR(g_error_text)
  94. END
  95.  
  96. /* Get settings from GoFetch! */
  97.  
  98. ADDRESS (FTP_PORT)
  99. GETDOWNLOADPATH
  100. localpath = RESULT
  101.  
  102. /* Create profile list in GoFetch! */
  103.  
  104. DO UNTIL EOF('created_file')
  105.  remotepath = READLN('created_file')
  106.  filename = READLN('created_file')
  107.  ADDPROFILE site port remotepath filename localpath
  108. END
  109.  
  110. CALL CLOSE('created_file')
  111.  
  112. /* Go get the files */
  113.  
  114. GOFETCH
  115. /*
  116. DO UNTIL finished = 1
  117.  DOWNLOADING?????
  118.  finished = RESULT
  119.  CALL DELAY(5*50)     ***This bit needs re-doing as and when you add the appropriate command***
  120. END
  121.  
  122. /* Quit GoFetch! */
  123.  
  124. QUITGOFETCH 
  125. */
  126.  
  127. /* Delete Batchfile */
  128.  
  129. IF ~DELETE(batch_file) THEN CALL SCRIPT_ERROR(d_error_text)
  130.  
  131. EXIT 
  132.  
  133. /* ----------Create function() script_error---------- */
  134.  
  135. script_error:
  136.  
  137. PARSE ARG text
  138.  
  139. error = RTEZREQUEST(text,exit_buttons,title,,)
  140. IF error=0 THEN EXIT
  141.  
  142. /* ----------Create function() library_error---------- */
  143.  
  144. library_error:
  145.  
  146. DO
  147.  ADDRESS COMMAND
  148.  'C:RequestChoice PUBSCREEN="Workbench" TITLE="batch2gofetch.rexx v0.8ß by Steve Bridges" BODY=" Could not execute Arexx script. *n Please check you have rexxreqtools.library *n and rexxsupport.library installed in Libs:" GADGETS="Exit" >NIL:'
  149.  IF RC=0 THEN EXIT
  150. END
  151.